
var 节流 =  {
  template: /*html*/`
  <div>
  <div>节流</div>
    <input id="fn3" :value="text" @input="change">
    <p>{{text}}</p>
  </div>
    `,
  setup(){
    //节流, 固定时间内, 不管触发多少次, 都只执行一次
    const text = ref('')
  
    let timer = null
    const change = (e) => {
      if (timer) {
        return
      }
      timer = setTimeout(() => {
        text.value = e.target.value
        timer = null
      }, 1000)
    }

    return {
      text,change
    }
  },
}
